package com.cmict.data.system.service.encode;

import com.cmict.data.system.controller.admin.encode.vo.EncodeDetailsCreateReqVO;
import com.cmict.data.system.controller.admin.encode.vo.EncodeDetailsReqVO;
import com.cmict.data.system.dal.dataobject.encode.EncodeDetailsDO;
import com.cmict.data.system.dal.mysql.encode.EncodeDetailsMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class EncodeDetailsServiceImpl implements EncodeDetailsService {

    @Resource
    private EncodeDetailsMapper encodeDetailsMapper;

    @Override
    public Long createEncodeDetailsData(EncodeDetailsCreateReqVO reqVO) {
        encodeDetailsMapper.insert(reqVO);
        return reqVO.getId();
    }

    @Override
    public void createEncodeDetailsDataBatch(List<EncodeDetailsDO> reqList) {
        encodeDetailsMapper.insertBatch(reqList);
    }

    @Override
    public void updateEncodeDetailsData(EncodeDetailsCreateReqVO reqVO) {
        encodeDetailsMapper.updateById(reqVO);
    }

    @Override
    public void deleteEncodeDetailsData(Long id) {
        encodeDetailsMapper.deleteById(id);
    }

    @Override
    public void batchdeleteEncodeDetails(List<Long> ids) {
        encodeDetailsMapper.deleteBatchIds(ids);
    }

    @Override
    public List<EncodeDetailsDO> getDictEncodeDetailsList(EncodeDetailsReqVO reqVO) {
        return encodeDetailsMapper.selectList(reqVO);
    }

    @Override
    public EncodeDetailsDO getEncodeDetailsData(Long id) {
        return encodeDetailsMapper.selectById(id);
    }

    @Override
    public List<EncodeDetailsDO> selectList(Long id) {

        return encodeDetailsMapper.selectList(id);
    }
}
